package com.integrate.mybatis.controller;

import com.integrate.mybatis.domain.ConsumerUser;
import com.integrate.mybatis.service.ConsumerUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘志强
 * @date 2020/11/27 14:18
 */
@RestController
@Slf4j
@CrossOrigin
public class TestController {

    @Autowired
    private ConsumerUserService consumerUserService;


    /**
     * 获取Consumer来源的用户
     *
     * @param id
     * @return
     */
    @GetMapping("getConsumerUser")
    public ConsumerUser getConsumerUser(Long id) {
        return consumerUserService.getConsumerUser(id);
    }


    /**
     * 添加consumer用户
     *
     * @param consumerUser
     * @return
     */
    @PostMapping("addConsumerUser")
    public String addConsumerUser(ConsumerUser consumerUser) {
        return consumerUserService.addConsumerUser(consumerUser);
    }

}
